/*
 * @Description: 种养品种管理
 */
import zhreq from "@/api/axios";
import zhreqs from "@/api/axios";
export default {
  /**
   * @description: 获取种养品种 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   */
  getlist(params) {
    return zhreqs.post(`/v3/templateTenant/plantVariety/queryPageByCondition`, {
    // return zhreqs.post(`/om/plantVariety/v3/queryPageList/${sessionStorage.farmingTypeNo}`, {
      page: params.page,
      size: params.size,
      order: 'asc',
      auditFlag: 1,
      entity: {
        // "organizationNo": 0,
        "plantTypeName": params.varietyNameLike,
        "farmingTypeNo": sessionStorage.farmingTypeNo
      }
    });
  },
  getAllList(params) {
    return zhreqs.post(`/v3/category/plantVariety/queryPageByCondition`, {
      ...params
    });
  },
  /**
   * @description:模糊查询种养品种表格列表 *代表必填
   */
  getqueryList(params) {
    return zhreq.post("/v3/templateTenant/plantVariety/queryByCondition", {
      auditFlag: 1,
      varietyNameLike: params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 批量添加种养品种
   * @param {Object}  *
   */
  addlist(list) {
    return zhreq.post('/v3/templateTenant/plantVariety/importPublicList', {
      list: list,
      organizationNo: sessionStorage.organizationNo,
      farmingTypeNo: sessionStorage.farmingTypeNo
    });
  },
  /**
   * @description: 批量删除种养品种
   * @param {Object}  *
   */
  dellist(params) {
    return zhreq.post('/v3/templateTenant/plantVariety/delListByNo', {
      list: params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 通过种养类别查种养品种
   * @param {Object}  *
   */
  querybycondition(params) {
    return zhreq.post('/v3/templateTenant/plantVariety/queryByCondition', {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 上传图片获取id
   * @param {Object}  *
   */
  upimgmet(params) {
    return zhreq.post('/v3/templateTenant/plantVarietyPicture/add', {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 查看图片
   * @param {Object}  *
   */
  seeimgmet(params) {
    return zhreq.get(`/v3/templateTenant/plantVarietyPicture/queryByNo?no=${params}&organizationNo=${sessionStorage.organizationNo}`, {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  }, /**
  * @description: 查看图片
  * @param {Object}  *
  */
  // getimgmet(no) {
  //   return zhreq.get(`/v3/templateTenant/plantVarietyPicture/queryByNo?no=${no}&organizationNo=${sessionStorage.organizationNo}`);
  // },
  seeimgmets(params) {
    return zhreq.get(`/v3/category/plantVarietyPicture/queryByNo?no=${params}&organizationNo=${sessionStorage.organizationNo}`, {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 通过种养类别查种养品种
   * @param {Object}  *
   */

  queryByPlantTypeNo(no) {
    return zhreq.post('/v3/templateTenant/plantVariety/queryByPlantTypeNo', {
      plantTypeNo: no,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 通过种养类别查种养品种
   * @param {Object}  *
   */

  queryBycategoryPlantTypeNo(no) {
    if (typeof no !== 'object') { no = { plantTypeNo: no } }
    return zhreq.post('/v3/category/plantVariety/queryByCondition', {
      ...no,
      organizationNo: sessionStorage.organizationNo
    });
  },
  /**
   * @description: 获取种养类别
   * @param {Object}  *
   */
  getAllBList() {
    return zhreq.get(`v3/category/plantType/queryTree?farming=PLANT`);
  },
  addList(params) {
    return zhreq.post(`v3/category/applyPlantVariety/add`, {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  editList(params) {
    return zhreq.post(`v3/category/applyPlantVariety/edit`, {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  getList(params) {
    return zhreq.post(`v3/category/applyPlantVariety/queryByCondition`, {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  }

  // queryPlantVarityByNo(no){
  //   return zhreq.get(`/v3/templateTenant/plantVariety/queryByNo?no=${no}&organizationNo=${sessionStorage.organizationNo}`);
  // },

};
